package afc.dc.project;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
/**
 * This is the home screen. This activity appears after the splash
 * screen.  This is the activity the user will use to navigate the
 * application. Its more like the directory of this application
 * It handles all the clicks of all the buttons in this class :)
 * @author bori
 *
 */
public class Home extends Activity{
	private Button aboutUs, pastorsButton, scheduleOfService, contactUs, prayerRequest, newsAndEvent, newsTab;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		/*The next two lines of code gets rid of the title and makes the app fullscreen. We want to do it right
		 * before we set the content view*/
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.main);
		newsTab = (Button) findViewById(R.id.newsTAB);
		setClick(newsTab,"afc.dc.project.NEWSTAB");
		aboutUs = (Button) findViewById(R.id.aboutUs);
		setClick(aboutUs,"afc.dc.project.ABOUTUS");
		pastorsButton = (Button) findViewById(R.id.pastorsGreeting);
		setClick(pastorsButton,"afc.dc.project.PASTORS");
		scheduleOfService = (Button) findViewById(R.id.scheduleOfService);
		setClick(scheduleOfService,"afc.dc.project.SCHEDULEOFSERVICES");
		contactUs = (Button)findViewById(R.id.contactUs);
		setClick(contactUs,"afc.dc.project.CONTACTUS");
		prayerRequest = (Button)findViewById(R.id.prayerRequest);
		setClick(prayerRequest,"afc.dc.project.PRAYER");
		newsAndEvent = (Button)findViewById(R.id.newsAndEvents);
		setClick(newsAndEvent, "afc.dc.project.NANDE");
		
	}
	/**
	 * This method handles when a button on the home screen is clicked.
	 * The point of this method is to make the code look clean
	 * @param button
	 * @param manifest
	 */
	private void setClick(Button button, final String manifest){
		button.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(manifest);
				startActivity(intent);
			}
		});
	}
}
